#include <iostream>
#include <string>
using namespace std;
class People{
protected:  
    string name;
    string gender;
    int age;
public:
    People(string name,string gender,int age){
        this->name=name;
        this->gender=gender;
        this->age=age;
    }
    ~People(){
        cout<<"People 对象 "<<this<<" 被销毁"<<endl;
    }
};

class Student: virtual public People{
protected:
    string id;
    double grade;

public:
    Student(string name,string gender,int age,string id,double grade)
        :People(name,gender,age){
            this->id=id;
            this->grade=grade;
    }
    ~Student(){
        cout<<"Student 对象 "<<this<<" 被销毁"<<endl;
    }
};

class Teacher: virtual public People{
protected:    
    string job;
    string department;

public: 
    Teacher(string name,string gender,int age,string job,string department)
        :People(name,gender,age){
            this->job=job;
            this->department=department;
    }

    ~Teacher(){
        cout<<"Teacher 对象 "<<this<<" 被销毁"<<endl;
    }
};

class GradOnWork:public Student,public Teacher{
    string researchDirection;
    string supervisor;
public:
    GradOnWork(string name,string gender,int age,
        string id,double grade,
        string job,string department,
        string researchDirection,string supervisor)
        :People(name,gender,age),
        Student(name,gender,age,id,grade),
        Teacher(name,gender,age,job,department){
            this->researchDirection=researchDirection;
            this->supervisor=supervisor;
        }
    ~GradOnWork(){
        cout<<"GradOnWork 对象 "<<this<<" 被销毁"<<endl;
    }

    string toString(){
        return "GradOnWord{姓名:"+name
            +" ,性别:"+gender
            +" ,年龄:"+to_string(age)
            +" ,学号:"+id
            +" ,成绩:"+to_string(grade)
            +" ,职称:"+job
            +" ,所在系:"+department
            +" ,研究方向:"+researchDirection
            +" ,指导老师:"+supervisor+"}";
    }
};

int main(){
    GradOnWork gdonwk("张三", "男", 20, "2019001", 90.5,
         "教授", "计算机系", "机器学习", "李老师");
    cout<<gdonwk.toString()<<endl;
    return 0;
}